﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Back_end.Models
{
	public class News
	{
		[Key]
		[HiddenInput(DisplayValue = false)]
		public string NewsId
		{ get; set; }

		/// <summary>
		/// 发布者Id，仅用于记录
		/// </summary>
		[Display(Name = "发布者")]
		//[HiddenInput(DisplayValue = false)]
		public string UserName
		{ get; set; }

		[Required]
		[Display(Name = "标题")]
		public string Title
		{ get; set; }

		/// <summary>
		/// 最后修改时间
		/// 发布或更新时都自动获取当前时间
		/// </summary>
		[Display(Name = "发布日期")]
		[DataType(DataType.DateTime)]
		//[HiddenInput(DisplayValue = false)]
		public DateTime PublishedDate
		{ get; set; }

		[Required]
		[Display(Name = "内容")]
		public string Text
		{ get; set; }

		[Display(Name = "图片")]
		public string ImgPath
		{ get; set; }
	}
}